This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(readr)
## Warning: package 'readr' was built under R version 4.0.5
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
library(data.table)
## Warning: package 'data.table' was built under R version 4.0.4
library(plotly)
## Warning: package 'plotly' was built under R version 4.0.5
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
ID_5651 <- read_csv("inps/ID-5651.csv")
## Rows: 215339 Columns: 10
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (6): Regione, Provincia, Cittadinanza, Classe età , sesso, Posizione Prev...
## dbl (4): Anno, Lavoratori, rr_cumulo_Sum, ss_cum_total_Sum
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
ID_5585 <- read_csv("inps/ID-5585.csv")
## Rows: 12244 Columns: 10
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (8): Regione, Settore__attività _economica, Nazionalità , sesso, Tipologia...
## dbl (2): Anno, Numero_variazioni
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
summary dt
summary(ID_5585)
## Anno Regione Settore__attività _economica
## Min. :2019 Length:12244 Length:12244
## 1st Qu.:2019 Class :character Class :character
## Median :2019 Mode :character Mode :character
## Mean :2019
## 3rd Qu.:2019
## Max. :2019
## Nazionalità sesso Tipologia_variazione Classe_di_etÃ
## Length:12244 Length:12244 Length:12244 Length:12244
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## Presenza_part_time tipologia_incentivo Numero_variazioni
## Length:12244 Length:12244 Min. : 1.00
## Class :character Class :character 1st Qu.: 1.00
## Mode :character Mode :character Median : 5.00
## Mean : 48.75
## 3rd Qu.: 20.00
## Max. :6833.00
variazioni_dt <- as.data.table(ID_5585)
variazioni_dt[,max(Numero_variazioni),.(Regione,Tipologia_variazione,tipologia_incentivo,Nazionalità )]
## Regione Tipologia_variazione
## 1: Piemonte Trasformazioni a tempo indeterminato di rapporti a termine
## 2: Piemonte Trasformazioni a tempo indeterminato di rapporti a termine
## 3: Piemonte Trasformazioni a tempo indeterminato di rapporti a termine
## 4: Piemonte Trasformazioni a tempo indeterminato da rapporti stagionali
## 5: Piemonte Apprendisti trasformati a tempo indeterminato
## ---
## 481: Estero Trasformazioni a tempo indeterminato da rapporti intermittenti
## 482: Estero Trasformazioni a tempo indeterminato da rapporti stagionali
## 483: Estero Trasformazioni a tempo indeterminato da rapporti intermittenti
## 484: Estero Apprendisti trasformati a tempo indeterminato
## 485: Estero Trasformazioni a tempo indeterminato di rapporti a termine
## tipologia_incentivo Nazionalità V1
## 1: Esonero giovani Italiana 409
## 2: Nessuna agevolazione Italiana 2456
## 3: Altro Italiana 60
## 4: Nessuna agevolazione Italiana 45
## 5: Apprendistato Italiana 870
## ---
## 481: Nessuna agevolazione Italiana 2
## 482: Nessuna agevolazione Straniera 1
## 483: Nessuna agevolazione Straniera 1
## 484: Apprendistato Straniera 1
## 485: Altro Italiana 1
fig <- plot_ly(variazioni_dt[Numero_variazioni<100], x = ~Numero_variazioni, color = ~Tipologia_variazione, type = "box")
fig
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.